<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		
		<script type="text/javascript">
			
			// String类 内置了几个使用正则的方法
			
			// match() 返回匹配到的内容
			var str1 = "I'm a boy.";
			var re1 = /boy/i;
			document.write(str1.match(re1)); 
			document.write("<br />")
			// search() 返回的是找到的位置
			var str2 = "I like Javascript";
			var re2 = /Javascript/i;
			document.write(str2.search(re2));// 7
			document.write("<br />")
			// replace
			var str3 = "I like Javascript";
			var re3 = /Javascript/i;
			document.write(str3.replace(re3,"JS"));
			document.write("<br />")
			// split
			var str4 = "Javascrpt,C#,VB_Dart_C++_php";
			var re4 = /[,_]/;
			var arr = str4.split(re4);
			document.write(arr);
			
			
		</script>
	</body>
</html>
